import time as t


def readlist(filename):
    file = open(filename, "r")
    data = file.readlines()
    file.close()
    return data


def bubblesort(nums):
    swapped = True
    while swapped:
        swapped = False
        for i in range(len(nums) - 1):
            if nums[i] > nums [i + 1]:
                nums[i], nums [i + 1] = nums[i + 1], nums[i]
                swapped = True


n1 = readlist('')
n2 = readlist('')
n3 = readlist('')


time_start = t.time()
bubblesort(n1)
#print(nums)
time_end = t.time()
print((time_end - time_start) * 1000)


time_start = t.time()
bubblesort(n2)
#print(nums)
time_end = t.time()
print((time_end - time_start) * 1000)


time_start = t.time()
bubblesort(n3)
#print(nums)
time_end = t.time()
print((time_end - time_start) * 1000)